﻿@{   
    Layout = null;
    ViewData["Title"] = "YouXiao";
}
<script src="~/js/vue.js"></script>
<script src="~/js/axios.js"></script>
<script src="~/element-ui/lib/index.js"></script>
<link rel="stylesheet" href="~/element-ui/lib/theme-chalk/index.css" />
<div id="app">
    <el-card class="box-card">
        <div slot="header" class="clearfix">
            <span>您正在做的业务是：人力资源--招聘管理--简历管理--有效简历查询 </span>
        </div>
        <div>
            <el-descriptions :column="2" style="width:90%;" border>
                <el-descriptions-item>
                    <template slot="label">
                        请选择职位分类
                    </template>
                    <el-cascader expand-trigger="hover"
                                 :options="HeBingData"
                                 :props="cascaderProps"
                                 v-model="selectedKeys"
                                 v-on:change="parentCateChanged"
                                 clearable
                                 change-on-select
                                 ref="casc">
                    </el-cascader>
                </el-descriptions-item>
                <el-descriptions-item>
                    <template slot="label">
                        关键字
                    </template>
                    <el-input style="width:100%" v-model="fourName"></el-input>
                </el-descriptions-item>
                <el-descriptions-item>
                    <template slot="label">
                        登录时间
                    </template>
                    <el-date-picker type="date" style="width:35%" placeholder="选择日期" v-model="time1"></el-date-picker>至
                    <el-date-picker type="date" style="width:35%" placeholder="选择日期" v-model="time2"></el-date-picker>(YYYY-MM-DD)
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <el-button type="primary" v-on:click="TiaoJian()">查询</el-button>
                </el-descriptions-item>
            </el-descriptions>
            @*查询*@
            <el-table :data="tableData"
                      style="width: 100%"
                      v-show="isShow">
                <el-table-column prop="res_id"
                                 label="简历主键"
                                 width="180"
                                 v-if="false">
                </el-table-column>
                <el-table-column prop="human_major_kind_name"
                                 label="职位分类"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_major_name"
                                 label="职位名称"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_name"
                                 label="姓名"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_mobilephone"
                                 label="手机号码"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_idcard"
                                 label="身份证号"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_history_records"
                                 label="个人履历"
                                 width="180">
                </el-table-column>
                <el-table-column prop="regist_time"
                                 label="登记时间"
                                 width="180">
                    <template v-if="(scope.row.regist_time!='0001-01-01T00:00:00')" slot-scope="scope">{{scope.row.regist_time | dateFormat}}</template>
                </el-table-column>
                <el-table-column prop="recomandation"
                                 label="推荐意见"
                                 width="180">
                </el-table-column>
                <el-table-column prop="interview_status"
                                 label="推荐面试"
                                 width="180"
                                 :formatter="selectState">
                </el-table-column>
                @*<el-table-column label="操作">
                <template slot-scope="scope">
                <el-button size="mini"
                v-on:click="Update(scope.row)">筛选</el-button>
                </template>
                </el-table-column>*@
            </el-table>
        </div>
    </el-card>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            tableData: [],
            //级联属性
            HeBingData: [],
            cascaderProps: {
                value: "id",
                label: "name",
                children: "children",
            },
            selectedKeys: [],
            //查询开关
            isShow: false,
            fourName: "",
            time1: "",
            time2: "",
        },
        methods: {
            //条件查询 点击打开查询
            TiaoJian() {
                if (this.fourName == '') {
                    this.YouXiao();
                } else {
                    this.isShow = true;
                    //console.info(this.zhi)
                    axios.get("/JianLiGuanLi/YouXiaoFind", { params: { type: this.zhi[0], name: this.zhi[1], fourName: this.fourName, time1: this.time1, time2: this.time2 } }).then(res => {
                        this.tableData = res.data;
                    })
                }
            },
            //查全部
            YouXiao() {
                axios.get("/JianLiGuanLi/SelYouX").then(res => {
                    this.isShow = true;
                    this.tableData = res.data;
                })
            },
            //状态转换
            selectState(rows) {
                console.info("rows:", rows);
                if (rows.recomandation == "不推荐面试") return "否"
                if (rows.recomandation != "") return "是"
            },
            //时间过滤器方法
            TimeGuoLvQi() {
                // 定义时间过滤器，
                Vue.filter('dateFormat', function (originDate, pattern = '') {
                    // 根据给定的时间字符串，得到特定的时间
                    var dt = new Date(originDate)
                    //   yyyy-mm-dd
                    var y = dt.getFullYear()
                    var m = (dt.getMonth() + 1).toString().padStart(2, '0')
                    var d = dt.getDate().toString().padStart(2, '0')
                    if (pattern.toLowerCase() === 'yyyy-mm-dd') {
                        return `${y}-${m}-${d}`
                    } else {
                        var hh = dt.getHours().toString().padStart(2, '0')
                        var mm = dt.getMinutes().toString().padStart(2, '0')
                        var ss = dt.getSeconds().toString().padStart(2, '0')
                        //return `${y}-${m}-${d}`
                        return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
                    }
                })
            },
            //职位分类 职位名称 查询方法
            FindHeBing() {
                axios.get("/JianLiGuanLi/HeBing").then(res => {
                    this.HeBingData = res.data;
                })
            },
            //职位分类，职位名称  改变事件
            parentCateChanged() {
                //选中值有就大于0
                if (this.selectedKeys.length > 0) {
                    //获取键
                    this.key = this.selectedKeys;
                    //console.info(this.selectedKeys);
                    //获取值
                    this.zhi = this.$refs["casc"].getCheckedNodes()[0].pathLabels;
                    //console.log(this.zhi)
                }
            },
        },
        mounted() {
            this.FindHeBing();
            this.TimeGuoLvQi();
        }
    })
</script>
<style scoped>
    .el-descriptions-item__label.is-bordered-label {
        background: white;
        color: black;
    }

    .el-descriptions {
        height: 240px;
    }
</style>
